<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>${lotter.name } - ${keyChinese }</title>
		<%@include file="/WEB-INF/base.jspf"%>
		<style type="text/css">
			.btn2,.btn3 {
				color:red;
				font-weight:bold;
				font-size:19px;
				font-family:Arial;
				font-weight:bold;
				-moz-border-radius:0px;
				-webkit-border-radius:0px;
				border:1px solid #dcdcdc;
				text-decoration:none;
				background:-webkit-gradient( linear, left top, left bottom, color-stop(48%, #ededed), color-stop(57%, #dfdfdf) );
				background:-moz-linear-gradient( center top, #ededed 48%, #dfdfdf 57% );
				background:-ms-linear-gradient( top, #ededed 48%, #dfdfdf 57% );
				filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
				background-color:#ededed;
				display:inline-block;
				text-shadow:1px 1px 0px #ffffff;
			 	-webkit-box-shadow:inset 2px 0px 10px 0px #ffffff;
			 	-moz-box-shadow:inset 2px 0px 10px 0px #ffffff;
			 	box-shadow:inset 2px 0px 10px 0px #ffffff;
			}
			.act{
				-moz-border-radius:8px;
				-webkit-border-radius:8px;
				border:1px solid #d83526;
				text-decoration:none;
				background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #fe1a00), color-stop(100%, #ce0100) );
				background:-moz-linear-gradient( center top, #fe1a00 5%, #ce0100 100% );
				background:-ms-linear-gradient( top, #fe1a00 5%, #ce0100 100% );
				filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe1a00', endColorstr='#ce0100');
				background-color:#fe1a00;
				color:#fff;
				display:inline-block;
				text-shadow:1px 1px 0px #b23e35;
			 	-webkit-box-shadow:inset 1px 1px 0px 0px #f29c93;
			 	-moz-box-shadow:inset 1px 1px 0px 0px #f29c93;
			 	box-shadow:inset 1px 1px 0px 0px #f29c93;
			}
			.btn1{margin: 50px 5%;color:blue ;}
			.btn2{width: 40px;height: 40px;line-height:40px;border-radius:100px;margin: 2%; }
			.btn3{border-radius:5px ;padding:15px 20px; font-size: 20px;min-width: 70px; }
			.table1{margin-top: 10px;}
			.table1 tr td{height: 37px;padding:0 5px;color: white;font-size: 14px;}
			.ctr{color: ;font-weight: bold;}
			.qzhsw{color: white;font-size:20px;font-weight: bold;margin-top: 30px; }
			
			.zdsd *{font-size: 14px;}
			.hemei input{text-align: center;}
		</style>
	</head>
	<body style="height: 100%">
		<span id="id" class="hidden">${lotter.id }</span>
		<span id="cplay1" class="hidden">${keyChinese }</span>
		<span id="cname1" class="hidden">${lotter.name }</span>
		<span id="orderid" class="hidden"></span>
		<span id="cname" class="hidden">${lotter.cname }</span>
		<span class="timespace hidden">${lotter.timespace }</span>
		<span id="lasttime" class="lasttime hidden">${lotter.lottertime }</span>
		<span id="cplay" class="hidden">${key}</span>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4" style="position: fixed;top: 0;height: 150px;z-index: 5;padding: 0px;background:#264F8C; ">
			<img alt="" src="/img/caizhong/bg/bg.png" width="100%" height="150px;"/>
		</div>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4" style="padding: 10px 20px;position: fixed;top: 0;height: 130px;z-index: 10;">
			<div class="row">
				<div style="color: white;font-weight: bold;font-size: 20px;text-align: center;margin-top: -4px;">${lotter.name } <span class='font12	'>${keyChinese }</span></div>
			
				<a onclick="back()" class="glyphicon glyphicon-chevron-left fl" style="color: white;margin-top: -24px;"></a>
				<a onclick="help('${lotter.helpurl}','${lotter.name }')" style="color: white;margin-top: -24px;" class="fr">购彩助手</a>
			</div>
			<img class="fr" alt="" src="/img/caizhong/${lotter.cname }.png" height="70px" width="70px" style="right: 10px;position: fixed;top: 50px;">
			<table class="row table1">
				<tr>
					<td>
						距 <span style="font-size: 14px;" class="xiaqi">${lotter.period+1 }</span> 开奖 <span id="djs" style="font-size: 14px;font-weight: bold;color: yellow;"></span>
					</td>
				</tr>
				<tr>
					<td class="">
						第 <span style="font-size: 14px;" class="period">${lotter.period }</span> 期（上期）开奖号码：
					</td>
				</tr>
				<tr>
					<td>
						<span class="lotternumber">${lotter.lotternumber }</span>
					</td>
				</tr>
			</table>
		</div>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4" style="padding: 10px;text-align: center;margin-top: 172px;">
			${script }
			<script>
				document.write("<div>");
				for(var i=0;i<k.length;i++){
					document.write(
						"<button class='btn3 01' style='margin:10px;'>"+k[i]+"</button>"
					)
				}
				if(k.length!=0){
					document.write("<input class='hidden' id='temp1' /></div>");
				}
				
				var q="";
				var a=0;
				for(var i=z[0];i<z[1];i++){
					if(z[2]==2){
						q+="<button class='btn2 "+bu0(i)+"'>"+bu0(i)+"</button>";
					}else{
						q+="<button class='btn2 "+bu0(i)+"'>"+i+"</button>";
					}
					a++;
					if(a%5==0)q+="<br>";
				}
				if($("#cplay").text().indexOf('2thdx')!=-1){
					for(var i=0;i<t.length;i++){
						document.write(
							"<div class='text-left xz xuanze"+(i+1)+"' >"
							+"<div class='ctr fl' style='width:7%;'>"+t[i]+"</div>"
							+"<div class='xz1 fl text-center' style='width:86%;margin-right:7%;'>"
								+"<a class='btn1' text='all'>全</a>"
								+"<a class='btn1' text='da'>大</a>"
								+"<a class='btn1' text='xiao'>小</a>"
								+"<a class='btn1' text='dan'>单</a>"
								+"<a class='btn1' text='shuang'>双</a>"
								+"<a class='btn1' text='qing'>清</a>"
						
								+"<div class='x"+i+"'>"
									+q+"<input class='hidden' id='temp2' /><br>"
								+"</div>"
							+"</div>"
						+"</div>"				
						)
					}
				}else{
					for(var i=0;i<t.length;i++){
						document.write(
							"<div class='text-left xz xuanze"+(i+1)+"' >"
							+"<div class='ctr fl' style='width:7%;'>"+t[i]+"</div>"
							+"<div class='xz1 fl text-center' style='width:86%;margin-right:7%;'>"
								+"<a class='btn1' text='all'>全</a>"
								+"<a class='btn1' text='da'>大</a>"
								+"<a class='btn1' text='xiao'>小</a>"
								+"<a class='btn1' text='dan'>单</a>"
								+"<a class='btn1' text='shuang'>双</a>"
								+"<a class='btn1' text='qing'>清</a>"
						
								+"<div class='x"+i+"'>"
									+q+"<input class='hidden' id='temp"+(i+1)+"' /><br>"
								+"</div>"
							+"</div>"
						+"</div>"				
						)
					}
				}
			</script>
		</div>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4 history" style="padding: 5px;text-align: left;">
			<hr>
			${dataList }
		</div>
		<div class="zdsd hidden" style='position: fixed;top:0;left:0;width: 100%;height: 100%;z-index: 60;background:rgba(0,0,0,0.5) ;'>
		</div>
		<div class="zdsd hidden set" style='position: fixed;left:0;z-index: 100;color: gray;padding: 15px;text-align: left;background: white;height: 238px;width: 80%;margin:10% ;bottom: 50px;border-radius:20px;border: 1px solid gray; '>
			<ul style="width: 100%;">
				<li style="text-align: center;height: 40px;">
					<strong style="font-size: 30px;color: black;">注 单 设 定</strong>
				</li>
				<li style="line-height: 22px;">
					<span style="float: left;">最高赔率：<span id="maxpl">${lotter.rebate1 }</span></span>
					<br><span id="id" class="hidden"></span>
					<span>单注金额：</span><input id="danzhu" class="bbbbb" value="${user.betacount }" style="border:1px white solid;border-bottom:1px solid gray; width: 40px;text-align: center;" />元
					<span>注数：共 <span id="zhusu"></span> 注</span><br>
					<span>总额：<span id="heji"></span>元</span><br>
					<span>若中奖，单注最高中：<span id="makzj" style="color:red;"></span>元</span><br>
					<span style="color: red;">发起合买 <input type="checkbox" id="checkboxhm" /></span><br><br>
				</li>
				<li class="hemei hidden" style="text-align: center;padding:0 10px 10px;">
					<strong style="font-size: 20px;color: black;">合 买 设 置</strong>
				</li>
				<li class="hemei hidden" style="line-height: 25px;">
					<span>我要分为：<input class="fs" style="width: 40px;border:1px white solid;border-bottom:1px solid gray;" value="0" /> 份　<span style="color: red;font-size: 10px;">每份￥<span class="meifen" style="color: red;font-size: 10px;">0.00</span>元</span></span><br>
					<span>我要提成：税后盈利的 <select><option class="tc">0%</option><option>1%</option><option>2%</option><option>3%</option><option>4%</option><option>5%</option><option>6%</option><option>7%</option><option>8%</option></select></span><br>
					<span>我要认购：<input class="rg" style="width: 40px;border:1px white solid;border-bottom:1px solid gray;" value="0" /> 份　<span style="color: red;font-size: 10px;">￥<span class="rengou" style="color: red;font-size: 10px;">0</span>元</span></span><br>
					<span>我要保底：<input class="bd" style="width: 40px;border:1px white solid;border-bottom:1px solid gray;" value="0"/> 份　<span style="color: red;font-size: 10px;">￥<span class="baodi" style="color: red;font-size: 10px;">0</span>元</span></span><br><br>
				</li>
				
				<li style="text-align: center;line-height: 40px;border-top: 1px solid gray;">
					<a class="col-xs-6" style="border-right: 1px solid gray;" onclick="cancel()">取消</a>
					<a class="col-xs-6" style="color: blue;" onclick="submit()" >确定</a>
				</li>
			</ul>
		</div>
		<br>　<br>　
		<div id="foot" class="col-xs-12 col-sm-4 col-sm-offset-4 text-center" style="position: fixed;bottom: 0px;background: #EB6166;padding: 10px;left: 0;">
			<a onclick="clear1()" class="btn fl" style="width: 25%;background: red;color:white;border:1px solid red;">清　空</a>
			<a onclick="comit()" class="btn fr queren" style="width: 73%;color:white;border:1px solid white;">确　　定</a>
		</div>
	</body>
	<script type="text/javascript">
		$(function(){
			$("#range,#danzhu").bind('input propertychange', function() {
				jisuan();
		    });
			
			
			$(".hemei .fs").blur(function() {
				var reg = /^[1-9]\d*$/;
				var heji1=$("#heji").text();
				var jieguo=heji1/Number($(".fs").val());
				if(!reg.test(Number($(".fs").val().trim()))){
					$(".fs").val("1");
				}else if(heji1/Number($(".fs").val())=="Infinity"){
					$(".fs").val("1");
				}else if(jieguo<1){
					$(".fs").val("1");
				}else{
					if(jieguo.toString().indexOf(".")!=-1&&jieguo.toString().split(".")[1].length>3){
						jieguo=jieguo.toString().split(".")[0]+"."+(Number(jieguo.toString().split(".")[1].substr(0,3))+1);
					}
					$(".meifen").text(jieguo);
					$(".rengou").text(accMul(Number($(".rg").val()),Number($(".meifen").text())));
					$(".baodi").text(accMul(Number($(".bd").val()),Number($(".meifen").text())));
				}
			});
			$(".hemei .rg").blur(function() {
				var reg = /^[1-9]\d*$/;
				if(!reg.test(Number($(".rg").val().trim()))){
					$(".rg").val("1");
				}else{
					$(".rengou").text(accMul(Number($(".rg").val()),Number($(".meifen").text())));
				}
			});
			$(".hemei .bd").blur(function() {
				var reg = /^[0-9]\d*$/;
				if(!reg.test(Number($(".bd").val().trim()))){
					$(".bd").val("0")
				}else{
					$(".baodi").text(accMul(Number($(".bd").val()),Number($(".meifen").text())));
				}
			});
			
			$("#checkboxhm").click(function(){
				if($(".hemei").attr("class").indexOf("hidden")!=-1){
					$(".set").css("height","407px");$(".hemei").removeClass("hidden");
				}else{
					$(".set").css("height","238px");$(".hemei").addClass("hidden");
				}
			});
			qiu();
		});
		$(".btn2,.btn3").click(function(){
			$(".queren").text("确　　定");
			if($(this).attr("class").indexOf("act")!=-1){
				$(this).removeClass("act");
			}else{
				if($("#cplay").text().indexOf("dt")!=-1){
					var q=$(this).attr("class").replace("btn2 ","");
					$("."+q).removeClass("act");
					$("#temp1").val($("#temp1").val().replace(q+",",""))
					$("#temp2").val($("#temp2").val().replace(q+",",""))
				}
				$(this).addClass("act");
			}
			$a=$(this).parent().find("button");
			if($a.length==1){
				$a=$(this).parent().parent().find("div");
				$input=$(this).parent().siblings("input");
				$input.val("");
				for(var i=0;i<$a.length;i++){
					if($("#cplay").text().indexOf('bz')!=-1||$("#cplay").text().indexOf('3thtx')!=-1||$("#cplay").text().indexOf('3lhtx')!=-1){
						if($(".act").text()==''){
							$("#temp1").val("");
						}else{
							$("#temp1").val($(".act").text()+",");
						}
					}else if($a.eq(i).find("button").attr("class").indexOf("act")!=-1){
						$input.val($input.val()+$a.eq(i).find("button").text()+",");
					}
				}
			}else{
				$input=$(this).siblings("input");
				$input.val("");
				for(var i=0;i<$a.length;i++){
					if($a.eq(i).attr("class").indexOf("act")!=-1){
						$input.val($input.val()+$a.eq(i).text()+",");
					}
				}
			}
		});
		$(".btn1").click(function(){
			$(".queren").text("确　　定");
			var a=$(this).attr("text");
			$(this).siblings("div").find(".act").removeClass("act");
			if(a=="all"){
				$(this).siblings("div").find(".00,.01,.02,.03,.04,.05,.06,.07,.08,.09,.10,.11,.12,.13,.14,.15,.16,.17,.18,.19,.20,.21,.22,.23,.24,.25,.26,.27,.28,.29,.30,.31,.32,.33,.34,.35,.36,.37,.38,.39,.40,.41,.42,.43,.44,.45,.46,.47,.48,.49").addClass("act");
			}else if(a=="da"){
				if($("#cname").text().indexOf('ssc')!=-1){
					$(this).siblings("div").find(".05,.06,.07,.08,.09").addClass("act");
				}else if($("#cname").text().indexOf('11x5')!=-1){
					$(this).siblings("div").find(".07,.08,.09,.10,.11").addClass("act");
				}else if($("#cname").text().indexOf('xg6hc')!=-1){
					$(this).siblings("div").find(".26,.27,.28,.29,.30,.31,.32,.33,.34,.35,.36,.37,.38,.39,.40,.41,.42,.43,.44,.45,.46,.47,.48,.49").addClass("act");
				}else if($("#cname").text().indexOf('shssl')!=-1||$("#cname").text().indexOf('pl3')!=-1||$("#cname").text().indexOf('fc3d')!=-1){
					if(($("#cplay").text().indexOf('z3hz')!=-1)||($("#cplay").text().indexOf('z6hz')!=-1)){
						$(this).siblings("div").find(".14,.15,.16,.17,.18,.19,.20,.21,.22,.23,.24,.25,.26,.27").addClass("act");
					}else{
						$(this).siblings("div").find(".05,.06,.07,.08,.09").addClass("act");
					}
				}else if($("#cname").text().indexOf('28')!=-1){
					$(this).siblings("div").find(".14,.15,.16,.17,.18,.19,.20,.21,.22,.23,.24,.25,.26,.27").addClass("act");
				}else if($("#cname").text().indexOf('k3')!=-1){
					if($("#cplay").text().indexOf('hz')!=-1){
						$(this).siblings("div").find(".11,.12,.13,.14,.15,.16,.17,.18").addClass("act");
					}else{
						$(this).siblings("div").find(".04,.05,.06").addClass("act");
					}
				}else if($("#cname").text().indexOf('kl10f')!=-1){
					if($("#cplay").text().indexOf('swst')!=-1){
						$(this).siblings("div").find(".10,.11,.12,.13,.14,.15,.16,.17,.18").addClass("act");
					}else if($("#cplay").text().indexOf('swht')!=-1){
						$(this).siblings("div").find(".20").addClass("act");
					}else{
						$(this).siblings("div").find(".11,.12,.13,.14,.15,.16,.17,.18,.19,.20").addClass("act");
					}
				}else{
					$(this).siblings("div").find(".06,.07,.08,.09,.10").addClass("act");
				}
			}else if(a=="xiao"){
				if($("#cname").text().indexOf('ssc')!=-1){
					$(this).siblings("div").find(".00,.01,.02,.03,.04").addClass("act");
				}else if($("#cname").text().indexOf('11x5')!=-1){
					$(this).siblings("div").find(".01,.02,.03,.04,.05,.06").addClass("act");
				}else if($("#cname").text().indexOf('xg6hc')!=-1){
					$(this).siblings("div").find(".01,.02,.03,.04,.05,.06,.07,.08,.09,.10,.11,.12,.13,.14,.15,.16,.17,.18,.19,.20,.21,.22,.23,.24,.25").addClass("act");
				}else if($("#cname").text().indexOf('shssl')!=-1||$("#cname").text().indexOf('pl3')!=-1||$("#cname").text().indexOf('fc3d')!=-1){
					if(($("#cplay").text().indexOf('z3hz')!=-1)||($("#cplay").text().indexOf('z6hz')!=-1)){
						$(this).siblings("div").find(".00,.01,.02,.03,.04,.05,.06,.07,.08,.09,.10,.11,.12,.13").addClass("act");
					}else{
						$(this).siblings("div").find(".00,.01,.02,.03,.04").addClass("act");
					}
				}else if($("#cname").text().indexOf('28')!=-1){
					$(this).siblings("div").find(".00,.01,.02,.03,.04,.05,.06,.07,.08,.09,.10,.11,.12,.13").addClass("act");
				}else if($("#cname").text().indexOf('k3')!=-1){
					if($("#cplay").text().indexOf('hz')!=-1){
						$(this).siblings("div").find(".01,.02,.03,.04,.05,.06,.07,.08,.09,.10").addClass("act");
					}else{
						$(this).siblings("div").find(".01,.02,.03").addClass("act");
					}
				}else if($("#cname").text().indexOf('kl10f')!=-1){
					if($("#cplay").text().indexOf('swst')!=-1){
						$(this).siblings("div").find(".01,.02,.03,.04,.05,.06,.07,.08,.09").addClass("act");
					}else if($("#cplay").text().indexOf('swht')!=-1){
						$(this).siblings("div").find(".19").addClass("act");
					}else{
						$(this).siblings("div").find(".01,.02,.03,.04,.05,.06,.07,.08,.09,.10").addClass("act");
					}
				}else{
					$(this).siblings("div").find(".01,.02,.03,.04,.05").addClass("act");
				}
			}else if(a=="dan"){
				$(this).siblings("div").find(".01,.03,.05,.07,.09,.11,.13,.15,.17,.19,.21,.23,.25,.27,.29,.31,.33,.35,.37,.39,.41,.43,.45,.47,.49").addClass("act");
			}else if(a=="shuang"){
				$(this).siblings("div").find(".00,.02,.04,.06,.08,.10,.12,.14,.16,.18,.20,.22,.24,.26,.28,.30,.32,.34,.36,.38,.40,.42,.44,.46,.48").addClass("act");
			}
			$a=$(this).siblings("div").find("button");
			$input=$(this).siblings("div").find("input");
			$input.val("");
			
			for(var i=0;i<$a.length;i++){
				if($a.eq(i).attr("class").indexOf("act")!=-1){
					$input.val($input.val()+$a.eq(i).text()+",");
				}
			}
		});
		var dd=window.setInterval(function(){
			var time1 = new Date().format("hh:mm:ss").split(":");//当前时间
			time1=Number(time1[0]*60*60)+Number(time1[1]*60)+Number(time1[2]);
			var time=$(".lasttime").text().split(" ")[1].split(":");//上期开奖 
			time=Number(time[0]*60*60)+Number(time[1]*60)+Number(time[2]);
			time=time+Number($(".timespace").text())-time1;
			time--;
			var hour=Math.floor(time/3600);
			var minute=Math.floor((time-hour*3600)/60);
			var second=time-hour*3600-minute*60;
			if(time<30){
				$("#fenpan").removeClass("hidden");
			}
			if(time<0){
				$("#djs").text("正在开奖…");
				getnewdata();
			}else{
				$("#djs").text(bu0(hour)+":"+bu0(minute)+":"+bu0(second));
			}
		},1000);
		
		$("body").append("<div id='fenpan' class='hidden' style='position: fixed;bottom:0px;width:100%;background:rgba(200,200,200,0.8);height:55px;line-height:55px;font-size:30px;text-align:center;color:white;'>已封盘</div>");
		
		
		function qiu(){
			var lotternumber=$(".lotternumber").text().split(",");
			var lotter="";
			for(var i=0;i<lotternumber.length-1;i++){
				lotter+="<div style='width:23px;height:23px;line-height:23px;font-size:13px;margin-right:6px; background:url(/img/caizhong/bg/1.png);background-size: 100% 100%;color:black;font-weight: bold;' class='fl text-center yuan'>"+lotternumber[i]+"</div>";
			}
			var lotternumber1=$(".lotternumber1").text().split(",");
			$(".lotternumber").html(lotter);
		}
		
		function getnewdata(){
			ajax({
				url:'getnewdata.do',
				type:'post',
				data:{key:$("#cname").text()},
				success:function(data){
					var json=eval('('+data+')');
					if($(".xiaqi").text()==json.data.period){
						$(".lotternumber").text(json.data.lotternumber);
						$(".xiaqi").text(Number(json.data.period)+1);
						$(".period").text(json.data.period);
						$(".lasttime").text(json.data.lottertime);
						qiu();
						$("#fenpan").addClass("hidden");
					}/* else{console.log($(".xiaqi").text()+" @"+json.data.period)} */
				},
				error:function(){
					alert("发生未知错误");
				}
			});
		}
		window.onload=function () {
			
		    document.addEventListener('touchstart',function (event) {
		        if(event.touches.length>1){
		            event.preventDefault();
		        }
		    })
		    var lastTouchEnd=0;
		    document.addEventListener('touchend',function (event) {
		        var now=(new Date()).getTime();
		        if(now-lastTouchEnd<=300){
		            event.preventDefault();
		        }
		        lastTouchEnd=now;
		    },false)
		}	
	</script>
</html>
